import { request } from '../request';

export function fetchAreaList() {
  return request.get<Factory.Area[]>(`/factory/getAreaList`);
}

export function fetchMachineListByFactory(factoryName: string) {
  return request.get<Factory.Machine[]>(`/factory/getMachineListByFactory?factoryName=${factoryName}`);
}

export function fetchMachineGroupList() {
  return request.get<Factory.MachineGroup[]>(`/factory/getMachineGroupList`);
}

export function fetchMachineListByArea(areaname: string) {
  return request.get<Factory.Machine[]>(`/factory/getMachineListByArea?areaname=${areaname}`);
}

export function fetchMachineByMachineName(machineName: string) {
  return request.get<Factory.Machine>(`/factory/getMachineByMachineName?machineName=${machineName}`);
}

export function fetchInsertOrUpdateMachine(machine: Factory.Machine) {
  return request.post<boolean>(`/factory/insertOrUpdateMachine`, machine);
}

export function fetchDeleteMachine(machine: Factory.Machine) {
  return request.post<boolean>(`/factory/deleteMachine`, machine);
}

export function fetchProcessFlowListByFactory(factoryName: string) {
  return request.get<any>(`/factory/getProcessFlowListByFactory?factoryName=${factoryName}`);
}

export function fetchProcessOperationByFactory(factoryName: string) {
  return request.get<any>(`/factory/getProcessOperationByFactory?factoryName=${factoryName}`);
}

export function fetchProcessFlowSeq(processflowname: string) {
  return request.get<any>(`/factory/getProcessFlowSeq?processflowname=${processflowname}`);
}
